package com.shuda.business.engine.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 引擎状态实体类
 * 用于存储数据处理引擎的运行状态
 * 
 * @author ink
 * @Description: 引擎状态实体
 * @date 2024-10-10 14:40:00
 */
@Data
@TableName("engine_status")
@Schema(name = "EngineStatusEntity", description = "引擎状态实体")
public class EngineStatusEntity {

    @TableId(type = IdType.AUTO)
    @Schema(description = "主键ID")
    private Long id;

    @Schema(description = "引擎名称")
    private String engineName;

    @Schema(description = "引擎状态(running-运行中,stopped-已停止,error-错误)")
    private String engineStatus;

    @Schema(description = "最后启动时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastStartTime;

    @Schema(description = "最后停止时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastStopTime;

    @Schema(description = "处理数据总数")
    private Long processedCount;

    @Schema(description = "成功处理数量")
    private Long successCount;

    @Schema(description = "失败处理数量")
    private Long failedCount;

    @Schema(description = "当前队列长度")
    private Integer queueLength;

    @Schema(description = "错误信息")
    private String errorMessage;

    @Schema(description = "引擎配置(JSON格式)")
    private String engineConfig;

    @Schema(description = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "删除标记(0-正常,1-删除)")
    @TableLogic
    private Integer deleted;
}